﻿<Window x:Class="Terry.PanBrowser"
    xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c="clr-namespace:Terry"
    xmlns:b="clr-namespace:Terry;assembly=BrillWpf"
    xmlns:helpers="clr-namespace:AC.AvalonControlsLibrary.Controls;assembly=Helpers"
    Title="Terry's PanBrowser" Height="400" Width="700" 
        Loaded="Window_Loaded" SizeChanged="Window_SizeChanged" MouseWheel="Window_MouseWheel" KeyUp="Window_KeyUp" Closing="Window_Closing">
    
    <Window.Resources>

        <DataTemplate DataType="{x:Type c:SliderInt}">
            <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
                <Label Content="{Binding Name}"></Label>
                <Slider Width="100" Minimum="{Binding From}" Maximum="{Binding To}" Value="{Binding Val, Mode=TwoWay}" Tag="{Binding Name}"
                        HorizontalAlignment="Stretch" ValueChanged="Slider_ValueChanged"
                        SmallChange="1" LargeChange="2"/>
                <Label Content="{Binding Path=Val}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate DataType="{x:Type c:SliderDouble}">
            <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
                <Label Content="{Binding Name}"></Label>
                <Slider Name="Slider" Width="100" HorizontalAlignment="Stretch" 
                        Minimum="{Binding From}" Maximum="{Binding To}" Value="{Binding Val, Mode=TwoWay}" Tag="{Binding Name}" 
                        ValueChanged="Slider_ValueChanged"
                        SmallChange="0.1" LargeChange="5"/>
                <Label ContentStringFormat="F2" Content="{Binding Path=Val}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate DataType="{x:Type c:SliderText}">
            <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal" Margin="25,0,0,0">
                <Label Content="{Binding Name}"/>
                <TextBox TextChanged="TextBox_TextChanged" MinWidth="100" Tag="{Binding Name}"
                         Text="{Binding Path=Val, UpdateSourceTrigger=PropertyChanged}"/>
            </StackPanel>
        </DataTemplate>

        <DataTemplate DataType="{x:Type c:ImageComboData}" x:Key="ImageComboTemplate">
            <StackPanel Orientation= "Horizontal">
                <Image Source="{Binding Path=bitmap}"/>
                <TextBlock Text="{Binding Path=text}" Margin="3"  VerticalAlignment="Center"/>
            </StackPanel>
        </DataTemplate>
    </Window.Resources>
    
    <Grid Name="_grid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="350" />
            <ColumnDefinition Width="452*" />
        </Grid.ColumnDefinitions>
        <StackPanel Name="designerPanel" Margin="5">
            <StackPanel Orientation="Horizontal">
                <b:PlayButton3D Name="play" ClipToBounds="False" Height="25" Width="25" MouseUp="PlayButton3D_MouseUp"/>
                <b:PauseButton3D Name="pause" Visibility="Collapsed" ClipToBounds="False" Height="25" Width="25"
                                 MouseUp="PauseButton3D_MouseUp"/>
                <TextBlock Margin="5,0,0,0"><Hyperlink Name="Screensaver" Click="Screensaver_Click">Screensaver</Hyperlink></TextBlock>
                <TextBlock Margin="5,0,0,0"><Hyperlink Name="Save" Click="Save_Click">Save Image</Hyperlink></TextBlock>
            </StackPanel>
            <Border Name="panImageControls" Margin="2">
                <StackPanel>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="25" />
                            <ColumnDefinition Width="25" />
                        </Grid.ColumnDefinitions>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <Label>Image:</Label>
                            <ComboBox Name="panImageCombo1" ItemTemplate="{StaticResource ImageComboTemplate}" SelectedValuePath="text"
                                      SelectionChanged="panImageCombo1_SelectionChanged"  Background="White" 
                                      HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" 
                                      />
                        </StackPanel>
                        <Button Content="-" Height="23" Name="RemoveTransform" Width="23" Grid.Column="1" Background="White" 
                                ToolTip="Remove Transform" Click="RemoveTransform_Click" Tag="0" FontWeight="Bold" 
                                />
                        <Button Content="+" Height="23" Name="AddTransform" Width="23" Grid.Column="2" Background="White" 
                                ToolTip="Add Transform" Click="AddTransform_Click" Tag="0" FontWeight="Bold" 
                                />
                    </Grid>
                    <ItemsControl Name="panImageSliderList" MinWidth="50" Margin="2" HorizontalContentAlignment="Stretch"/>
                </StackPanel>
            </Border>
        </StackPanel>
        <DockPanel Name="imagePanel" Grid.Column="1" Margin="5">
                <Image Name="bitmap" Stretch="Fill"/>
        </DockPanel>
        
    </Grid>
</Window>
